<!DOCTYPE HTML>
<title>Tests that duration is known after playback ended.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<video></video>
<script>
async_test(function(t) {
    var video = document.querySelector("video");

    video.onended = t.step_func_done(function() {
        assert_greater_than(video.duration, 0);
    });

    video.onplaying = t.step_func(function() {
        video.onplaying = null;
        video.currentTime = video.duration - 0.2;
    });

    video.src = "content/test.ogv";
    video.play();
});
</script>